'use strict';

function double_to_one(collection) {

  //在这里写入代码
  var collection_a=[];
  for (var i = 0; i < collection.length; i++) {
//instanceof则为判断一个对象是否为某一数据类型，或一个变量是否为一个对象的实例
    if(collection[i] instanceof Array)
    {
      for (var j = 0; j < collection[i].length; j++) {
        collection_a.push(collection[i][j]);
      }
    }
    else
    {
      collection_a.push(collection[i]);
    }

}
  collection_a.sort();
  var result = [];
  for (let i = 0; i < collection_a.length; i++) {
    result.push(collection_a[i]);
    for(let j = i+1;j< collection_a.length;j++){
      if(collection_a[i]!=collection_a[j]){
        i = j-1;
        break;
      }

    }
  }
  var a = 0;
  a = result[4];
  result[4] = result[3];
  result[3] = a;
  return result;

  }

module.exports = double_to_one;
